<?php
namespace Common\Controller;
use Think\Controller;
class BaseController extends Controller {

	static  $_action_block = 1;
	public  $staff_id = 0;
	public  $role_id  = 0;
	const ROLE_TEACHER     = 4;//普通教职工
	const ROLE_TEACHER_MGR = 3;//学院领导
	const ROLE_BAOWEICHU   = 1;//保卫处管理员
	public function _initialize(){
//		session_destroy();exit;
		$this->assign('action',self::$_action_block);
		$this->assign('web_site_title',C('web_site_title'));
		//检测登录
		tag('check_login');
		//检测权限
		tag('check_purview');

		$this->staff_id = $_SESSION['USER']['staff_id'];
		$this->role_id = $_SESSION['USER']['role_id'];
		//图片上传路径
		$this->assign('image_path',C('FILE_VIEW_PATH'));
		$this->assign('menus',$_SESSION['menus']);
		$this->assign('roleid_and_name',C('roleid_and_name'));
		$this->assign('session',$_SESSION);
//		dump($_SESSION);
//		exit;
	}

	/**
	 * 展示图片详情,子类继承后重载此函数,
	 */
	public function viewImage(){
		$image_path = I('get.u','','htmlspecialchars');
		if(empty($image_path)){
			$this->error('image dose not exits!');
		}
		$image_path = base64_decode($image_path);
		$image_path = C('FILE_VIEW_PATH').$image_path;
		$this->assign('image_path',$image_path);
	}
}